package com.gyh.stlserver.controller;

import com.gyh.stlserver.constants.Constants;
import com.gyh.stlserver.service.ChartsService;
import com.gyh.stlserver.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/charts")
public class ChartsController {
    @Autowired
    private ChartsService chartsService;
    @GetMapping("/hotCourse")
    public Result getHotCourse(String date){
        List<Map<String,Object>> maps = chartsService.getHotCourse(date);
        return Result.success(Constants.STATUS_200,maps);
    }
    @GetMapping("/weekMember")
    public Result getWeekMember(String date){
        List<Map<String,Object>> maps = chartsService.getWeekMember(date);
        return Result.success(Constants.STATUS_200,maps);
    }
    @GetMapping("/memberTotal")
    public Result getMemberTotal(){
        Integer memberTotal = chartsService.getMemberTotal();
        return Result.success(Constants.STATUS_200,memberTotal);
    }
    @GetMapping("/coachTotal")
    public Result getCoachTotal(){
        Integer coachTotal = chartsService.getCoachTotal();
        return Result.success(Constants.STATUS_200,coachTotal);
    }
    @GetMapping("/courseTotal")
    public Result getCourseTotal(){
        Integer courseTotal = chartsService.getCourseTotal();
        return Result.success(Constants.STATUS_200,courseTotal);
    }
    @GetMapping("/reserveTotal")
    public Result getReserveTotal(){
        Integer reserveTotal = chartsService.getReserveTotal();
        return Result.success(Constants.STATUS_200,reserveTotal);
    }
    @GetMapping("/weekCourse")
    public Result getWeekCourse(String date){
        List<Map<String,Object>> maps = chartsService.getWeekCourse(date);
        return Result.success(Constants.STATUS_200,maps);
    }
    @GetMapping("/weekCoach")
    public Result getWeekCoach(String date){
        List<Map<String,Object>> maps = chartsService.getWeekCoach(date);
        return Result.success(Constants.STATUS_200,maps);
    }
    @GetMapping("/weekReserve")
    public Result getWeekReserve(String date){
        List<Map<String,Object>> maps = chartsService.getWeekReserve(date);
        return Result.success(Constants.STATUS_200,maps);
    }
    @GetMapping("/reserveCount")
    public Result getReserveCount(String date){
        List<Map<String,Object>> maps = chartsService.getReserveCount(date);
        return Result.success(Constants.STATUS_200,maps);
    }
    @GetMapping("/hotCoach")
    public Result getHotCoach(String date){
        List<Map<String,Object>> maps = chartsService.getHotCoach(date);
        return Result.success(Constants.STATUS_200,maps);
    }
}
